package org.hawk.gwt.ppc.introspection.impl;

import java.util.Collections;
import java.util.List;

import org.hawk.gwt.ppc.introspection.JavaScope;
import org.hawk.gwt.ppc.introspection.JavaTypeScope;
import org.hawk.gwt.ppc.introspection.JavaWildcardGenericTypeScope;

/**
 * Represents wildcard parameters.
 * 
 * @author alex.bereznevatiy@gmail.com
 *
 */
final class JavaWildcardGenericTypeScopeImpl extends
		AbstractJavaGenericTypeScope implements JavaWildcardGenericTypeScope {
	
	private JavaTypeScope lowerBound;
	private List<JavaTypeScope> upperBounds;

	JavaWildcardGenericTypeScopeImpl(JavaScope owner, JavaTypeScope lowerBound, JavaTypeScope upperBound) {
		super(upperBound, owner);
		this.lowerBound = lowerBound;
		if (upperBound == null) {
			this.upperBounds = Collections.emptyList();
		} else {
			this.upperBounds = Collections.singletonList(upperBound);
		}
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.introspection.JavaWildcardGenericTypeScope#getLowerBound()
	 */
	public JavaTypeScope getLowerBound() {
		return lowerBound;
	}

	/*
	 * (non-Javadoc)
	 * @see org.hawk.gwt.ppc.introspection.JavaWildcardGenericTypeScope#getUpperBounds()
	 */
	public List<JavaTypeScope> getUpperBounds() {
		return upperBounds;
	}
}
